package lab03.test03;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Created by Administrator on 2017/11/23.
 */
public class Test01 {
    public static void main(String[] args) {


        // 字节流写文件
        String path = "E:\\hello2.txt";
        FileOutputStream fileOutputStream = null;
        try {
            fileOutputStream = new FileOutputStream(path);

            byte[] tmp = new byte[3];
            tmp[0] = 65;
            tmp[1] = 66;
            tmp[2] = 67;

            fileOutputStream.write("Hello,world!".getBytes());


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {

            try {
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }


    }
}
